var dataTable = {
  data () {

    return {
      searchSet: {},
      query: {

        index: 1,
        pageSize: 10
      },
      tableLoading: false,
      tableData: [],
      itemTotal: 0,
      pickerTimeOptions: {
        shortcuts: [{
          text: '今天',
          onClick (picker) {
            picker.$emit('pick', new Date());
          }
        }, {
          text: '昨天',
          onClick (picker) {
            const date = new Date();
            date.setTime(date.getTime() - 3600 * 1000 * 24);
            picker.$emit('pick', date);
          }
        }, {
          text: '一周前',
          onClick (picker) {
            const date = new Date();
            date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', date);
          }
        }]
      },
    }
  },
  created () {

  },
  mounted () {
  },
  methods: {
    isLastPageSingleItem () {
      let isSingleItem = false
      if (this.query.index > 1 && this.itemTotal % this.query.pageSize == 1) {
        let sumPageCount = Math.ceil(this.itemTotal / this.query.pageSize)
        if (this.query.index == sumPageCount) {
          isSingleItem = true
        }
      }
      return isSingleItem
    },
    // 触发搜索按钮
    handleSearch () {      
      this.$set(this.query, 'index', 1);
      this.getData();
    },
    /**整合搜索条件参数 */
    getQuery () {
      let obj = {}
      Object.keys(this.searchSet).map(key => {
        if (this.searchSet[key] !== '' && this.searchSet[key] != undefined) {
          if (this.searchSet[key] instanceof String) {
            obj[key] = this.searchSet[key].trim()
          } else {
            obj[key] = this.searchSet[key]
          }
        }
      })
      return Object.assign(obj, this.query)
    },
    getData () {

    },
    handleRefresh () {
      this.getData()
    },
    // 分页导航
    handlePageChange (val) {

      this.$set(this.query, 'index', val);
      this.getData();
    },
    handlePageSizeChange (val) {
      this.$set(this.query, 'pageSize', val);
      this.getData();
    },
  }
}
export default dataTable